<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/12/9
 * Time: 10:26
 */
session_start();
$key=$_COOKIE['userkey'];
if (isset($_SESSION[$key])){
    //清除cookie
    setcookie('userkey','',time()-10,'/');
//清除session
    unset($_SESSION[$key]);

    echo '退出成功<a href="../index.php">返回主页</a>';
}